package com.atguigu.springcloud.service;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")    //eureka服务注册中心注册的名字
public interface PaymentFeignService {


    /**
     * @param id
     * @return Payment
     * @description: 加上@Param注解，mapper中就可以采用#{}的方式把@Param注解括号内的参数进行引用
     */
    @GetMapping(value = "/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);


    /**
     * @param
     * @return
     * @description: 模拟超时
     */
    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeOut();
}
